package core
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.system.Security;
	
	import org.ais.event.TEvent;
	import org.ais.system.Ais;

	public class Main extends Sprite
	{
		public function Main()
		{
			try {
				Security.allowDomain("*");
				Security.allowInsecureDomain("*");
			}
			catch (error:*) {}
		}
		
		public function connect(im:*):void
		{
			TEvent.newTrigger("SWF_COMPLETE_ALL", __completeHandler);
			Ais.IMain.stage.scaleMode = "noScale";
			Ais.IMain.stage.align = "TL";
			with (graphics) {
				beginFill(0x111111);
				drawRect(0, 0, Ais.IMain.stage.stageWidth, Ais.IMain.stage.stageHeight);
				endFill();
			}
			var _l:MovieClip = new _AISY_LOADING();
			_l.width = _l.height = 90;
			_l.x = (width - _l.width) * 0.5;
			_l.y = (height - _l.height) * 0.5;
			addChild(_l);
			Ais.IMain.stage.addChild(parent);
			_l = null;
			im = null;
		}
		
		private function __completeHandler():void
		{
			Ais.IMain.Swf.remove(Ais.IMain.Swf.hasSwf("swf", parent));
		}
		
	}
}